package com.ujiuye.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class DemoController {

    @RequestMapping("/demodata")
    public ModelAndView demo1(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("main");
        modelAndView.addObject("message","hello spring");
        return modelAndView;
    }

    @RequestMapping("/demohtml")
    public String demo2(Model model){
        model.addAttribute("message","hello spring");
        return "main";
    }
}
